/*
 * Class: WebserviceCommunication
 * 
 * Created on Sep 14, 2013
 * 
 * (c) Copyright by Minh Tran
 * Global Cybersoft VN.
 * Floor 3-4-5, Helios Building, Quang Trung Software City
 */
package com.minh.tran;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.minh.tran.model.Gold;
import com.minh.tran.util.ItemUtil;

public class WebserviceCommunication extends AbstractWebservice
{
    /** The Constant LOG. */
    private static final Log LOG = LogFactory.getLog(WebserviceCommunication.class);

    /**
     * Instantiates a new webservice communication.
     */
    public WebserviceCommunication()
    {
        super();
    }

    /**
     * {@inheritDoc}
     * 
     * @see com.minh.tran.AbstractWebservice#request()
     */
    @Override
    protected void request()
    {
        for (Object g : this.queue.toArray())
        {
            Gold gold = (Gold) g;
            String appendText = "[" + gold.getPrice() + "][" + gold.getDateTime().toString() + "]";
            LOG.info(appendText);
            ItemUtil.writeFile(appendText);
        }
    }
}
